
import { observer } from 'mobx-react';
import React from 'react';
import CustomDialogStore from '../../stores/card/CustomDialog';
import { Button } from 'antd';
import { WeaDialog, WeaLocaleProvider } from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;

export interface CustomDialogProps {
    customDialog: CustomDialogStore;
    iconInfo?: any;
}
@observer
export default class CustomDialog extends React.Component<CustomDialogProps, any> {
    render() {
        const { customDialog, iconInfo={} } = this.props;
        const buttons = [<Button icon="cross" onClick={customDialog.onCancel}>{getLabel(309, '关闭')}</Button>,
        <Button type="primary" icon="save" loading={customDialog.loading} onClick={customDialog.onOk}>{customDialog.okText}</Button>];
        return (
            <WeaDialog
                className='wea-auth-modal cube-dialog'
                buttons={buttons}
                title={customDialog.title}
                iconBgcolor={iconInfo.iconBg || "#96358a"}
                icon={iconInfo.icon || 'icon-coms-ModelingEngine'}
                iconFontColor={iconInfo.iconColor || "#fff"}
                visible={customDialog.visible}
                style={{ width: '500px', height:  customDialog.height+'px'}}
                hasScroll={true}
                onCancel={customDialog.onCancel}
            >
                <div dangerouslySetInnerHTML={{ __html: customDialog.content }} />
            </WeaDialog >
        )
    }
}
